package com.liruo.learn.spring.mvc.controller.valid.validatedcommonbean;

import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author:liruo
 * @Date:2023-06-09-21:44:52
 * @Desc
 */
@Validated
@RestController
@RequestMapping("/validatedCommonBean")
@Slf4j
public class ValidatedCommonBean {

    @Data
    public static class CommonBean{
        private String name;
        private Integer age;
    }
    @PostMapping("/commonBean")
    public void commonBean(@Validated CommonBean commonBean){
        log.info("commonBean {}", commonBean);
    }
//    public interface FormGroup{}
//    @PostMapping("/form")
//    public void form(@Validated({Default.class, FormGroup.class}) Form form){
//        log.info("form {}", form);
//    }
}
